package com.me.utils;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Random;

/**
 * Created with IntelliJ IDEA.
 * Copyright@ Apache Open Source Organization
 *
 * @Auther: Apache
 * @Date: 2021/11/10/13:51
 * @Description:
 */
public class ScreenDataUtility {
    //---------------------------------------------http数据接口名称------------------------------------------//
    /**
     * 日期值班信息数据接口
     */
    private final static String riQiZhiBanXinXiData = "data1";
    /**
     * 安全运营天数数据接口
     */
    private final static String anQuanYunYingTianShuData = "data2";
    /**
     * 车站报警排名数据接口
     */
    private final static String cheZhanBaoJingPaiMingData = "data3";
    /**
     * 主所负荷数据接口
     */
    private final static String zhuSuoFuHeData = "data4";
    /**
     * 专业报警矩阵数据接口
     */
    private final static String zhuanYeBaoJingJuZhenData = "data5";
    /**
     * 能耗趋势图数据接口
     */
    private final static String nengHaoQuShiTuData = "data6";
    /**
     * 列车行车指标数据接口
     */
    private final static String lieCheXingCheZhiBiaoData = "data7";
    /**
     * 车站客流排名数据接口
     */
    private final static String cheZhanKeLiuPaiMingData = "data8";
    /**
     * 客流趋势图数据接口
     */
    private final static String keLiuQuShiTuData = "data9";
    /**
     * 列车实时报点信息数据接口
     */
    private final static String lieCheShiShiBaoDianXinXiData = "data10";
    /**
     * 月进站客流趋势数据接口
     */
    private final static String yueJinZhanKeLiuQuShiData = "data11";
    /**
     * 月行车趋势数据接口
     */
    private final static String yueXingCheQuShiData = "data12";
    /**
     * 月能耗趋势数据接口
     */
    private final static String yueNengHaoQuShiData = "data13";
    /**
     * 站年客流排名数据接口
     */
    private final static String zhanNianKeLiuPaiMingData = "data14";
    /**
     * 行车指标数据接口
     */
    private final static String xingCheZhiBiaoData = "data15";
    /**
     * 能耗类型占比数据接口
     */
    private final static String nengHaoLeiXingZhanBiData = "data16";

    public static String getXingCheZhiBiaoData() {
        return xingCheZhiBiaoData;
    }

    public static String getNengHaoLeiXingZhanBiData() {
        return nengHaoLeiXingZhanBiData;
    }

    public static String getZhanNianKeLiuPaiMingData() {
        return zhanNianKeLiuPaiMingData;
    }

    public static String getYueNengHaoQuShiData() {
        return yueNengHaoQuShiData;
    }

    public static String getYueXingCheQuShiData() {
        return yueXingCheQuShiData;
    }

    public static String getRiQiZhiBanXinXiData() {
        return riQiZhiBanXinXiData;
    }

    public static String getAnQuanYunYingTianShuData() {
        return anQuanYunYingTianShuData;
    }

    public static String getCheZhanBaoJingPaiMingData() {
        return cheZhanBaoJingPaiMingData;
    }

    public static String getZhuSuoFuHeData() {
        return zhuSuoFuHeData;
    }

    public static String getZhuanYeBaoJingJuZhenData() {
        return zhuanYeBaoJingJuZhenData;
    }

    public static String getNengHaoQuShiTuData() {
        return nengHaoQuShiTuData;
    }

    public static String getLieCheXingCheZhiBiaoData() {
        return lieCheXingCheZhiBiaoData;
    }

    public static String getCheZhanKeLiuPaiMingData() {
        return cheZhanKeLiuPaiMingData;
    }

    public static String getKeLiuQuShiTuData() {
        return keLiuQuShiTuData;
    }

    public static String getLieCheShiShiBaoDianXinXiData() {
        return lieCheShiShiBaoDianXinXiData;
    }

    public static String getYueJinZhanKeLiuQuShiData() {
        return yueJinZhanKeLiuQuShiData;
    }

    //---------------------------------------------数据模拟字符串集合------------------------------------------//
    /**
     * 班长名称
     */
    private final static String[] banZhangNames;
    /**
     * 值班员名称
     */
    private final static String[] zhiBanYuanNames;
    /**
     * 电话号码
     */
    private final static String[] phones;
    /**
     * S1线站点名称
     */
    private final static String[] stations;
    /**
     * 时间名称
     */
    private final static String[] times;
    /**
     * 列车编号名称
     */
    private final static String[] trainNumbers;
    /**
     * 月份名称
     */
    private final static String[] months;

    public static String[] getBanZhangNames() {
        return banZhangNames;
    }

    public static String[] getZhiBanYuanNames() {
        return zhiBanYuanNames;
    }

    public static String[] getPhones() {
        return phones;
    }

    public static String[] getStations() {
        return stations;
    }

    public static String[] getTimes() {
        return times;
    }

    public static String[] getTrainNumbers() {
        return trainNumbers;
    }

    static {
        banZhangNames = new String[]{"张进处", "李擅长", "王针具", "马夹角", "杨进来", "赵无参"};
        zhiBanYuanNames = new String[]{"张慧日", "李过渡", "王实时", "马的的", "赵海里", "胡夹打", "田晚点", "吴相当", "夏所示"};
        months = new String[]{"01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"};
        phones = new String[]{"13810717284", "15813713484", "17822343434", "13222233434", "17422238787", "15830717422", "17730717422", "18830717422", "13430717422"};
        stations = new String[]
                {
                        "唯亭站", "阳澄湖南站", "渔家灯火站", "城铁阳澄湖站",
                        "莲湖公园站", "祖冲之路站", "文化艺术中心站", "虹祺路站",
                        "鹿城路站", "白马泾路站", "玉山广场站", "珠江路站", "黑龙江路站",
                        "青阳路站", "顺帆路站", "金沙江路站", "洞庭湖路站", "时代大厦站",
                        "金融街站", "昆嘉路站", "洪湖路站", "城铁花桥站", "光夏路站",
                        "陆家站", "展览中心站", "西环路站", "花溪公园站", "花桥站"
                };
        times = new String[]
                {
                        "05:42:15", "05:44:15", "05:47:15", "05:48:15", "05:50:15",
                        "05:52:15", "05:54:15", "05:57:15", "05:59:15", "06:01:15",
                        "06:03:15", "06:05:15", "06:07:15", "06:09:15", "06:11:15",
                        "06:13:15", "06:15:15", "06:18:15", "06:20:15", "06:22:15",
                        "06:24:15", "06:27:15", "23:38:15", "23:36:15", "23:33:15",
                        "23:31:15", "23:29:15", "23:26:15", "23:24:15", "23:22:15",
                        "23:21:15", "23:19:15", "23:16:15", "23:14:15", "23:11:15",
                        "23:09:15", "23:06:15", "23:04:15", "23:03:15", "23:01:15",
                        "22:59:15", "22:57:15", "22:55:15", "22:53:15", "22:51:15",
                        "22:48:15", "22:47:15", "22:44:15", "22:41:15", "22:39:15",
                        "22:37:15", "22:35:15", "22:32:15", "22:30:15", "22:27:15"
                };
        trainNumbers = new String[]
                {
                        "01A0001", "01A0003", "01A0004", "01A0005", "01A0006", "01A0007",
                        "01A0008", "01A0002", "01B0001", "01B0002", "01B0003", "01B0004",
                        "01B0005", "01B0006", "01B0007", "01B0008", "01C0001", "01C0002",
                        "01C0003", "01C0004", "01C0005", "01C0006", "01C0007", "01C0008",
                        "01D0001", "01D0002", "01D0003", "01D0004", "01D0005", "01D0006",
                        "01D0007", "01D0008", "01E0001", "01E0002", "01E0003", "01E0004",
                        "01E0005", "01E0006", "01E0007", "01E0008", "01F0001", "01F0002",
                        "01F0007", "01F0008", "01F0001", "01F0002", "01F0003", "01F0004",
                        "01G0001", "01D0003", "01S0004", "01M0005", "01M0006", "01G0007",
                        "01H0008", "01G0002", "01H0001", "01N0002", "01N0003", "01M0004"
                };
    }

    /**
     * 随机获取班长
     *
     * @return 返回字符串String
     */
    public static String nextBanZhang() {
        Random rd = new Random();
        int index = rd.nextInt(banZhangNames.length - 1);
        if (index >= banZhangNames.length) {
            System.out.println("数组越界异常");
        }
        ;
        return banZhangNames[index];
    }

    /**
     * 随机获取值班人员
     *
     * @return 返回字符串数组String[]
     */
    public static String[] nextBanYuans() {
        Random rd = new Random();
        ArrayList indexs = new ArrayList();
        while (true) {
            int index = rd.nextInt(zhiBanYuanNames.length - 1);
            if (indexs.contains(index)) {
                continue;
            } else {
                indexs.add(index);
            }
            if (indexs.size() == 2)
                break;
        }
        String[] temps = new String[2];
        for (int i = 0; i < indexs.size(); i++) {
            temps[i] = zhiBanYuanNames[(int) indexs.get(i)];
        }
        return temps;
    }

    /**
     * 随机获取列车编号字符串
     *
     * @param size 个数
     * @return
     */
    public static String[] nextTrains(int size) {
        Random rd = new Random();
        ArrayList indexs = new ArrayList();
        while (true) {
            int index = rd.nextInt(trainNumbers.length - 1);
            if (indexs.contains(index)) {
                continue;
            } else {
                indexs.add(index);
            }
            if (indexs.size() == size)
                break;
        }
        String[] temps = new String[size];
        for (int i = 0; i < indexs.size(); i++) {
            temps[i] = trainNumbers[(int) indexs.get(i)];
        }
        return temps;
    }

    public static String[] nextTimes(int size) {
        Random rd = new Random();
        ArrayList indexs = new ArrayList();
        while (true) {
            int index = rd.nextInt(times.length - 1);
            if (indexs.contains(index)) {
                continue;
            } else {
                indexs.add(index);
            }
            if (indexs.size() == size)
                break;
        }
        String[] temps = new String[size];
        for (int i = 0; i < indexs.size(); i++) {
            temps[i] = times[(int) indexs.get(i)];
        }
        return temps;
    }

    /**
     * 随机获取手机号码
     *
     * @return 返回字符串数组String[]
     */
    public static String[] nextPhones() {
        Random rd = new Random();
        ArrayList indexs = new ArrayList();
        while (true) {
            int index = rd.nextInt(phones.length - 1);
            if (indexs.contains(index)) {
                continue;
            } else {
                indexs.add(index);
            }
            if (indexs.size() == 3)
                break;
        }
        String[] temps = new String[3];
        for (int i = 0; i < indexs.size(); i++) {
            temps[i] = phones[(int) indexs.get(i)];
        }
        return temps;
    }

    /**
     * 随机获取100-1000的数据
     *
     * @return String
     */
    public static String nextDay() {
        Random rd = new Random();
        int index = 365;
        while (true) {
            index = rd.nextInt(1000);
            if (index > 100)
                break;
        }
        return String.valueOf(index);
    }

    /**
     * 随机获取Count个车站名称
     *
     * @param count
     * @return
     */
    public static String[] nextStations(int count) {
        Random rd = new Random();
        ArrayList indexs = new ArrayList();
        while (true) {
            int index = rd.nextInt(stations.length - 1);
            if (indexs.contains(index)) {
                continue;
            } else {
                indexs.add(index);
            }
            if (indexs.size() == count)
                break;
        }
        String[] temps = new String[count];
        for (int i = 0; i < indexs.size(); i++) {
            temps[i] = stations[(int) indexs.get(i)];
        }
        return temps;
    }

    /**
     * 随机获取整数
     *
     * @param count
     * @return
     */
    public static Integer[] nextInteger(int count, int max) {
        Random rd = new Random();
        ArrayList indexs = new ArrayList();
        while (true) {
            int index = rd.nextInt(max);
            if (indexs.contains(index) || index == 0) {
                continue;
            } else {
                indexs.add(index);
            }
            if (indexs.size() == count)
                break;
        }
        Integer[] temps = (Integer[]) indexs.toArray(new Integer[count]);
        Arrays.sort(temps);
        return temps;
    }

    /**
     * 获取随机浮点数
     *
     * @param count 总个数
     * @param min   下限
     * @param max   上限
     * @return 返回的数组
     * @throws Exception
     */
    public static double[] nextDouble(int count, final double min, final double max) throws Exception {
        if (max < min) {
            throw new Exception("min < max");
        }
        double[] temps = new double[count];
        if (min == max) {
            return temps;
        }
        int i = 0;
        while (true) {
            if (i == count)
                return temps;
            temps[i] = min + ((max - min) * new Random().nextDouble());
            i++;
        }
    }

    /**
     * 获取随机整数
     *
     * @param count       取的数据总数
     * @param smallistNum 最小数
     * @param BiggestNum  最大数
     * @return 返回数组
     */
    public static int[] nextIntArray(int count, int smallistNum, int BiggestNum) {
        Random rd = new Random();
        int i = 0;
        int[] indexs = new int[count];
        while (true) {
            if (i == count)
                return indexs;
            indexs[i] = (Math.abs(rd.nextInt()) % (BiggestNum - smallistNum + 1)) + smallistNum;
            i++;
        }
    }

    /**
     * 将数据数组转成字符串数组
     *
     * @param arr
     * @return
     */
    public static <T> String[] converterFromNumericalArrToStringArr(T[] arr) {
        String[] strArray = null;
        if (arr != null) {
            strArray = new String[arr.length];
            for (int i = 0; i < arr.length; i++)
                strArray[i] = String.valueOf(arr[i]);
        }
        return strArray;
    }

    /**
     * 生成时间间隔
     *
     * @return
     */
    public static String generateTimeSpan() {
        int[] arr = nextIntArray(2, 5, 23);
        Arrays.sort(arr);
        return String.format("%d:00-%d:00", arr[0], arr[1]);
    }

    /**
     * 获取12个月字符串
     *
     * @return
     */
    public static String[] getMonths() {
        return months;
    }

    /**
     * 三分一个数
     *
     * @param number
     * @return
     */
    public static String[] trisection(double number) {
        double firstNumber = number / (Math.random() * 3 + 3.0);
        double secondNumber = Double.valueOf((number - firstNumber)) / Double.valueOf((Math.random() + 2.0));
        double thirdNumber = number - firstNumber - secondNumber;
        return new String[]{String.valueOf(firstNumber), String.valueOf(secondNumber), String.valueOf(thirdNumber)};
    }

    public static void main(String[] args) {

    }
}
